package com.li.o2oSystem.enums;

public enum ShopStateEnum {
	CHECK(0,"审核中"),
	OFFLINE(-1,"非法店铺"),
	SUCCESS(1,"操作成功"),
	PASS(2,"通过认证"),
	INNER_ERROR(-1001,"内部系统错误"),
	NULL_SHOPID(-1002,"shopId为空"),
	NULL_SHOP(-1003,"店铺信息为空");
	
	private int state;
	private String stateInfo;
	public int getState() {
		return state;
	}
	public String getStateInfo() {
		return stateInfo;
	}
	/**
	 * 私有化构造方法，不允许外部调用
	 * @param state
	 * @param stateInfo
	 */
	private ShopStateEnum (int state,String stateInfo){
		this.state = state;
		this.stateInfo = stateInfo;
	}
	/**
	 * 根据传入的状态值，返回相应的enum值
	 * @param state
	 * @return
	 */
	public static ShopStateEnum stateOf(int state){
		for(ShopStateEnum stateEnum:values()){//轮循
			if(stateEnum.getState() == state){
				return stateEnum;
			}
		}
		return null;
	}
}
